package com.jx.driving.request.domain;

import java.util.HashMap;
import java.util.Map;

/**
 * 参数ID定义
 * 
 * @author shenliuyang
 *
 *         2016年8月14日上午10:08:48
 */
public enum ParameterIdDefinition {
	//
	HEART_BEAT_INTERVAL(0X0001, Types.LONG, "客户端心跳发送间隔，单位为秒(s)"),
	//
	TCP_RESPONSE_TIME_OUT(0X0002, Types.LONG, "TCP 消息应答超时时间，单位为秒(s)"),
	//
	TCP_MSG_REPEAT_TIMES(0X0003, Types.LONG, "TCP 消息重传次数"),
	//
	UDP_RESPONSE_TIME_OUT(0X0004, Types.LONG, "UDP 消息应答超时时间，单位为秒(s)"),
	//
	UDP_MSG_REPEAT_TIMES(0X0005, Types.LONG, "UDP 消息重传次数"),
	//
	SMS_RESPONSE_TIME_OUT(0X0006, Types.LONG, "SMS 消息应答超时时间，单位为秒(s)"),
	//
	SMS_MSG_REPEAT_TIMES(0X0007, Types.LONG, "SMS 消息重传次数"),
	//
	DIAL_SERVER_CENTER(0X0010, Types.STRING, "主服务器 APN，无线通信拨号访问点。若网络制式为 CDMA，则该处为 PPP 拨号号码"),
	//
	DIAL_USERNAME(0X0011, Types.STRING, "主服务器无线通信拨号用户名"),
	//
	DIAL_PASSWORD(0X0012, Types.STRING, "主服务器无线通信拨号密码"),
	//
	DIAL_IP(0x0013, Types.STRING, "主服务器地址，IP 或域名"),
	//
	BACK_DIAL_SERVER_CENTER(0X0014, Types.STRING, "备份服务器 APN，无线通信拨号访问点"),
	//
	BACK_DIAL_USERNAME(0X0015, Types.STRING, "备份服务器无线通信拨号用户名"),
	//
	BACK_DIAL_PASSWORD(0X0016, Types.STRING, "备份服务器无线通信拨号密码"),
	//
	BACK_DIAL_IP(0X0017, Types.STRING, "备份服务器地址，IP 或域名"),
	//
	SERVER_TCP_PORT(0X0018, Types.LONG, "服务器 TCP 端口"),
	//
	SERVER_UDP_PORT(0X0019, Types.LONG, "服务器 UDP 端口"),
	//
	LOCATION_UPLOAD_STRATEGY(0X0020, Types.LONG, "位置汇报策略，0：定时汇报；1：定距汇报；2：定时和定距汇报"),
	//
	LOCATION_UPLOAD_SCHEMA(0X0021, Types.LONG, "位置汇报方案，0：根据 ACC 状态；1：根据登录状态和 ACC 状态，先判断登录状态，若登录再根据 ACC 状态"),
	//
	DRIVER_UN_LOGING_UPLOAD_INTERVAL(0X0022, Types.LONG, "驾驶员未登录汇报时间间隔，单位为秒(s),>0"),
	//
	HIBERNATE_UPLOAD_INTERVAL(0X0027, Types.LONG, "休眠时汇报时间间隔，单位为秒(s),>0"),
	//
	URGENT_WARNING_UPLOAD_INTERVAL(0X0028, Types.LONG, "紧急报警时汇报时间间隔，单位为秒(s),>0"),
	//
	DEFAULT_UPLOAD_INTERVAL(0X0029, Types.LONG, "缺省时间汇报间隔，单位为秒(s),>0"),
	//
	DEFAULT_DISTANCE_UPLOAD_INTERVAL(0X002C, Types.LONG, "缺省距离汇报间隔，单位为米(m),>0"),
	//
	DRIVER_UP_LOGIN_UPLOAD_DISTANCE_INTERVAL(0X002D, Types.LONG, "驾驶员未登录汇报距离间隔，单位为米(m),>0"),
	//
	HIBERNATE_UPLOAD_DISTANCE_INTERVAL(0X002E, Types.LONG, "休眠时汇报距离间隔，单位为米(m),>0"),
	//
	URGENT_WARNING_UPLOAD_DISTANCE_INTERVAL(0X002F, Types.LONG, "紧急报警时汇报距离间隔，单位为米(m),>0"),
	//
	CORNER_RELOAD_ANGLE(0X0030, Types.LONG, "拐点补传角度，<180°"),
	//
	MONITOR_PLATFORM_PHONE(0X0040, Types.STRING, "监控平台电话号码"),
	//
	RESET_PHONE(0X0041, Types.STRING, "复位电话号码，可采用此电话号码拨打终端电话让终端复位"),
	//
	RESTORE_FACTORY_PHONE(0X0042, Types.STRING, "恢复出厂设置电话号码，可采用此电话号码拨打终端电话让终端恢复"),
	//
	MONITOR_SMS_NUMBER(0X0043, Types.STRING, "监控平台 SMS 电话号码"),
	//
	DEVICE_ALERT_RECEIVER(0X0044, Types.STRING, "接收终端 SMS 文本报警号码"),
	//
	DEVICE_PHONE_RECEIVE_STRATEGY(0x0045, Types.LONG, "终端电话接听策略，0：自动接听；1：ACC ON 时自动接听，OFF 时手动接听"),
	//
	DEVICE_DIAL_PER_ONCE_MAX_SECONDS(0X0046, Types.LONG, "每次最长通话时间，单位为秒(s),0 为不允许通话，0xFFFFFFFF 为不限制"),
	//
	DEVICE_DIAL_PER_MONTH_MAX_SECONDS(0X0047, Types.LONG, "当月最长通话时间，单位为秒(s),0 为不允许通话，0xFFFFFFFF 为不限制"),
	//
	MONITOR_PHONE(0X0048, Types.STRING, "监听电话号码"),
	//
	SUPERVISOR_PRIVILEGE_SMS_NUMBER(0X0049, Types.STRING, "监管平台特权短信号码"),
	//
	ALERT_PREVENT_BIT(0X0050, Types.LONG, "报警屏蔽字。与位置信息汇报消息中的报警标识相对应，相应位为 1则相应报警被屏蔽"),
	//
	ALERT_SMS_PREVENT_BIT(0X0051, Types.LONG, "报警发送文本 SMS 开关，与位置信息汇报消息中的报警标识相对应，相应位为 1 则相应报警时发送文本 SMS"),
	//
	ALERT_CAMERA_PREVENT_BIT(0X0052, Types.LONG, "报警拍摄开关，与位置信息汇报消息中的报警标识相对应，相应位为1 则相应报警时摄像头拍摄"),
	//
	ALERT_STORE_PREVENT_BIT(0X0053, Types.LONG, "报警拍摄存储标识，与位置信息汇报消息中的报警标识相对应，相应位为 1 则对相应报警时牌的照片进行存储，否则实时长传"),
	//
	KEY_AND_LOCATION_BIT(0X0054, Types.LONG, "关键标识，与位置信息汇报消息中的报警标识相对应，相应位为 1 则对相应报警为关键报警"),
	//
	MAX_SPEED_LIMIT(0X0055, Types.LONG, "最高速度，单位为公里每小时(km/h)"),
	//
	OVER_SPEED_DURATION(0X0056, Types.LONG, "超速持续时间，单位为秒(s)"),
	//
	CONTINUOUS_DRIVING_LIMIT(0X0057, Types.LONG, "连续驾驶时间门限，单位为秒(s)"),
	//
	DAY_DRIVING_LIMIT(0X0058, Types.LONG, "当天累计驾驶时间门限，单位为秒(s)"),
	//
	MIN_REST_LIMIT(0X0059, Types.LONG, "最小休息时间，单位为秒(s)"),
	//
	MAX_PARKING_LIMIT(0X005A, Types.LONG, "最长停车时间，单位为秒(s)"),
	//
	IMAGE_QUALITY(0X0070, Types.LONG, "图像/视频质量，1-10,1 最好"),
	//
	BRIGHTNESS(0X0071, Types.LONG, "亮度，0-255"),
	//
	CONTRAST(0X0072, Types.LONG, "对比度，0-127"),
	//
	SATURABILITY(0X0073, Types.LONG, "饱和度，0-127"),
	//
	CHROMA(0X0074, Types.LONG, "色度，0-255"),
	//
	ODOMETER_NUMBER(0X0080, Types.LONG, "车辆里程表读数，1/10km"),
	//
	CAR_IN_PROVINCE_ID(0X0081, Types.INTEGER, "车辆所在的省域 ID"),
	//
	CAR_IN_CITY_ID(0X0082, Types.INTEGER, "车辆所在的市域 ID"),
	//
	CAR_NUMBER(0X0083, Types.STRING, "公安交通管理部门颁发的机动车号牌"),
	//
	CAR_COLOR(0X0084, Types.SHORT, "车牌颜色，按照 JT/T415-2006 的 5.4.12"),
	//
	CAR_PULSE_FACTOR(0X0085, Types.LONG, "车辆脉冲系数，车辆行驶1km距离过程中产生的脉冲信号个数");

	private static Map<Long, ParameterIdDefinition> idIndex = new HashMap<>();
	private final long id;
	private final Types type;
	private final String description;

	private ParameterIdDefinition(long id, Types type, String description) {
		this.id = id;
		this.type = type;
		this.description = description;
	}

	public long getId() {
		return id;
	}

	public Types getType() {
		return type;
	}

	public String getDescription() {
		return description;
	}

	public static final ParameterIdDefinition getById(Long parameterId) {
		if (!idIndex.isEmpty()) {
			return idIndex.get(parameterId);
		}
		idIndex = new HashMap<>();
		for (ParameterIdDefinition definition : ParameterIdDefinition.values()) {
			idIndex.put(definition.id, definition);
		}
		return idIndex.get(parameterId);
	}

	public static enum Types {
		STRING, LONG, INTEGER, SHORT;
	}

}
